using Lzfy_Refund_Service.Models;

namespace Lzfy_Refund_Service.Repositories
{
    /// <summary>
    /// 线上退费记录仓储接口
    /// </summary>
    public interface IPrepayRefundDetailRepository
    {
        /// <summary>
        /// 获取线上退费记录列表（分页）
        /// </summary>
        /// <param name="patientId">患者ID</param>
        /// <param name="patName">患者姓名</param>
        /// <param name="balanceSn">退费流水号</param>
        /// <param name="startDate">开始日期</param>
        /// <param name="endDate">结束日期</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页大小</param>
        /// <returns></returns>
        Task<(List<PrepayRefundDetail> records, int totalCount)> GetPrepayRefundDetailListAsync(
            string? patientId = null,
            string? patName = null,
            string? balanceSn = null,
            DateTime? startDate = null,
            DateTime? endDate = null,
            int pageIndex = 1,
            int pageSize = 20);

        /// <summary>
        /// 根据退费流水号获取线上退费记录
        /// </summary>
        /// <param name="balanceSn">退费流水号</param>
        /// <returns></returns>
        Task<PrepayRefundDetail?> GetPrepayRefundDetailByBalanceSnAsync(string balanceSn);

        /// <summary>
        /// 根据患者ID获取线上退费记录列表
        /// </summary>
        /// <param name="patientId">患者ID</param>
        /// <returns></returns>
        Task<List<PrepayRefundDetail>> GetPrepayRefundDetailsByPatientIdAsync(string patientId);

        /// <summary>
        /// 创建线上退费记录
        /// </summary>
        /// <param name="prepayRefundDetail">线上退费记录</param>
        /// <returns></returns>
        Task<bool> CreatePrepayRefundDetailAsync(PrepayRefundDetail prepayRefundDetail);

        /// <summary>
        /// 更新线上退费记录
        /// </summary>
        /// <param name="prepayRefundDetail">线上退费记录</param>
        /// <returns></returns>
        Task<bool> UpdatePrepayRefundDetailAsync(PrepayRefundDetail prepayRefundDetail);

        /// <summary>
        /// 删除线上退费记录
        /// </summary>
        /// <param name="balanceSn">退费流水号</param>
        /// <returns></returns>
        Task<bool> DeletePrepayRefundDetailAsync(string balanceSn);

        /// <summary>
        /// 审核线上退费记录
        /// </summary>
        /// <param name="balanceSn">退费流水号</param>
        /// <param name="auditUserId">审核人ID</param>
        /// <param name="auditUserName">审核人姓名</param>
        /// <returns></returns>
        Task<bool> AuditPrepayRefundDetailAsync(string balanceSn, string auditUserId, string auditUserName);

        /// <summary>
        /// 结算线上退费记录
        /// </summary>
        /// <param name="balanceSn">退费流水号</param>
        /// <returns></returns>
        Task<bool> SettlePrepayRefundDetailAsync(string balanceSn);

        /// <summary>
        /// 检查退费流水号是否存在
        /// </summary>
        /// <param name="balanceSn">退费流水号</param>
        /// <returns></returns>
        Task<bool> IsBalanceSnExistsAsync(string balanceSn);
    }
}